var mongoose = require("mongoose");
const md5=require('../util/md5')
var Schema = mongoose.Schema;

var userSchema = new Schema({
  username: {
    type: String,
    required: true,
   },
   email: {
    type: String,
    required: true,
   },
   password:{
       type:String,
       required:true,
       set:value=>md5(value),
       select:false
   },
   bio:{
       type:String,
       default:null
   },
   image:{
       type:String,
       default:null
   },
   createAt:{
       type:Date,
       default:Date.now
   },
   updateAt:{
       type:Date,
       default:Date.now
   }
  
});
module.exports = userSchema